home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sound Fx
/
Sound Fx.iso
/
Software
/
UNZIPED
/
MPW181-5
/
_SETUP.1
/
porting.txt
< prev
next >
Wrap
Text File
|
1997-04-21
|
8KB
|
197 lines
Porting notes (04/20/97)
-----------------------------------------------------------------------
Introduction:
Starting with maplay 1.2+ 1.81, I will try to make the source as
portable as possible. If you succeed in doing a port, please
e-mail the changes to me so everyone can benefit. You will be
credited accordingly, and you may distribute your port freely.
I have included output classes for a few other operating systems, but
I modified them slightly, and haven't tested the modified versions.
These came either from Tobias Bading's maplay 1.2, maplay 1.3, or
John Fehr.
Thanks go out to Tobias Bading for his original, portable maplay with
lots of Obuffer implementations, and John Fehr for the new
command-line source and his BeOS Obuffer, and the HP-UX buffer that
uses the audio server.
-----------------------------------------------------------------------
General guidelines:
You shouldn't have to delete anything, just add stuff. Try not to
mess around with too much stuff because you think it's bad style, or
whatever. The less you change, the easier it will be for me to
include your source in later releases of maplay, and the harder
it will be for you to use later releases of maplay. Try to keep track
of your changes so you can tell me what you did.
If you can, please support Borland compilers. They gave me a free
copy of BC++ 5.01, which is the reason for maplay 1.2+ getting as
far as it has. Not to mention that Borland compilers are probably
the best on the market.
I highly discourage using my code with ActiveX. I hate Microsoft's
internet strategy, which is basically the use of its vast resources
to replace anything well-written out there, like Java and Netscape,
with its own proprietary crap. (For example, integrating the
operating system shell with a WWW browser -- totally ridiculous and
a transparent move to make Netscape obsolete that must violate
some anti-trust law). Perhaps my mind has been warped by the
disgusting "smooth scrolling" of Internet Explorer, but I don't want
any part in what Microsoft is trying to accomplish with ActiveX.
-----------------------------------------------------------------------
How maplay works:
The general idea is that you have a main() that passes :
1. a newly created header
2. a newly created input bitstream
3. a mutex if you want your port to be seekable or stoppable once it
has begun playing
4. various decoding options such as which channels to decode, whether
to use stdout for output, etc.
These parameters are passed through the MPEG_Args class to maplay(),
which will continue to decode the stream until it is finished, or,
if your port is stoppable, until the "stop" member of the MPEG_Args
class is set to TRUE.
maplay() will create an operating system dependent output buffer
by calling create_obuffer(), and begin decoding.
-----------------------------------------------------------------------
Here is a rough procedure of what you need to do:
1. First you must decide what #define's to have. Here is a list of
of meanings if the following #defines are on:
__WIN32__ : Port is for Win32, like Windows 95, Windows NT, or
Win32S
AIX : Port is for IBM AIX
BEOS : Port is for BeOS
HPUX : Port is for HP-UX
IRIX : Port is for SGI Indigo 4.0
(ELF version of libaudio needed for 5.*, which is not
distributed with 5.2)
LINUX : Port is for Linux
NeXT : Port is for NeXT
SPARC : Port is for Sun SPARC
(you may add your own defines for your operating system, i.e.
FREEBSD, OS2, etc.)
If SPARC is defined, the following may be defined:
Solaris
SunOS
SunOS4_1_1
SunOS4_1_3
SunOS5+ : SunOS version 5.*
ULAW : For SPARC, BEOS, or the file output buffer, use 8 kHz,
ulaw output
GUI : Port is going to run in a window, so errors are reported
to dialog boxes instead of using cerr. This must be defined
if you are going to use any of the below xxxGUI defines.
WIN32GUI : Port is going to run in Win32 as a GUI version
(you may add your own defines for your windowing system, i.e.
X11R6GUI, TCLTKGUI, OS2GUI, etc.)
VERBOSE : For command-line versions, information on a stream is
printed before it is decoded.
SIXTEEN_BIT_COMPILER : "int" on your compiler is a 16 bit integer,
used for older compilers, like for DOS or
Windows 3.1
NObool : The "bool" type is not defined in your
compiler. I think this is for older,
non-ANSI C++ compilers.
DAMN_INTEL_BYTE_ORDER : Machine you want to port to is little endian,
like Intel x86's or Motorola 68k's
SEEK_STOP : The decoding of the stream will be seekable or stoppable
by the user once decoding has begun. This requires the
use of threads and mutexes.
If you have one of the supported operating systems, you may be able to
do a port just by changing defines and recompiling (and probably
making a Makefile)!
2. If you are compiling on a UNIX system, you will probably want to
rename all the .cpp files with a .cc extension. This is so that
gcc will work.
3. If you are not porting for a UNIX system or Win32, you will
probably need to modify "ibitstr.cpp" so you can read from files.
4. You also need to implement a output buffer to write to the audio
device. Use the virtual Obuffer class as the parent of your
new Obuffer class, and implement the functions declared in the
Obuffer class. If you want or need to have more information passed
to your new Obuffer, you can add members to the MPEG_Args class
(in "all.h"). Finally write a function to return a pointer to a new
instance of _your_ Obuffer, with the prototype :
Obuffer *create_obuffer(MPEG_Args *maplay_args);
Include the header for your new obuffer class in "obuffer.h", and
include the implementation file (*.cc) in "obuffer.cpp".
5. If you have decided to make your port seekable or stoppable, you
will have to fill in the missing functions in the OBuffer
subclasses (except in mci_obuf.cpp). Also you will have to fill
in the type for the mutex in "all.h" and implement locking and
unlocking in "mutx_imp.h".
After initializing the MPEG_Args, create a new thread running
maplay(). Your interface will communicate with maplay() through
the members of the MPEG_Args class.
When seeking or stopping, remember to lock the mutex before
accessing or changing the volatile variables that tell maplay
to stop, seek, where to seek, etc. After you have read or
written the appropriate variables, unlock the mutex.
Communication with the parent process in maplay() should be filled
in if desired.
6. If you want a command-line interface, make necessary any changes
to "cmdline.cpp". These changes will probably be setting
different members of the MPEG_Args class. If you planning on
doing a GUI version, you're pretty much on your own for that.
7. If you are doing a GUI version, fill in the parts where an error
message would have been sent to cerr, and instead pop open a
message box with the error message. Errors are reported in
"maplay.cpp", "header.cpp", and "ibitstr.cpp".
8. Create a Makefile if necessary. I have no idea how to make Makefiles
but I have included the Makefile from maplay 1.3b, "Makefile.old",
which should help. You can get most of the compiler flags for your
operating system in the file "config.sh.old"; just add the necessary
defines from above.
9. Once you are done, add yourself to the "credits.txt" file!
Congratulations! Please send me your changes as well as your
Makefile. Then you can distribute your port and be as famous as me
(Jeffy Tee-Say ???who???)!!
-----------------------------------------------------------------------
So far only there are only Win32 versions of maplay 1.2+ 1.81, but as
people do ports, I'll add them here. I'd especially like to see ports
for DOS and FreeBSD, since I can run those at home.
Jeff Tsay (ctsay@pasteur.eecs.berkeley.edu)